/*
 * @Author: 悦者生存 1002783067@qq.com
 * @Date: 2023-10-06 10:10:28
 * @LastEditors: 悦者生存 1002783067@qq.com
 * @LastEditTime: 2023-11-12 11:05:43
 * @FilePath: /koa2-ts-template/src/models/user.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const { DataTypes } = require('sequelize');
module.exports = (sequelize) => {
  const attributes = {
    user_id: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: null,
      field: 'user_id',
    },
    user_name: {
      type: DataTypes.STRING(100),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: 'user_name',
    },
    email: {
      type: DataTypes.STRING(100),
      allowNull: true,
      defaultValue: '',
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: 'email',
    },
    password: {
      type: DataTypes.STRING(100),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: 'password',
    },
    create_at: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: new Date(),
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: 'create_at',
    },
  };
  const options = {
    tableName: 'user',
    comment: '',
    indexes: [],
  };
  const UserModel = sequelize.define('user_model', attributes, options);
  return UserModel;
};
